@layout("/common/_container.html"){
	<!-- PAGE CONTENT BEGINS -->
	<form data-url="${ctxPath}/user/updatePassword" method="post" class="form-horizontal" role="form">
		<div class="space-4"></div>
		<!-- #section:elements.form -->
		<div class="form-group">
			<input type="hidden" name="user.id" value="${user.id!}"/>
			<label class="col-sm-2 control-label no-padding-right" > 原密码 </label>
			<div class="col-sm-3">
				<input type="password" name="user.oldPassword"  value="" placeholder="请输入原密码" class="form-control" />
			</div>
		</div>

		<div class="form-group" >
			<label class="col-sm-2 control-label no-padding-right" > 新密码 </label>
			<div class="col-sm-3">
				<input type="password" name="user.newPassword"  value="" placeholder="请输入新密码" class="form-control" />
			</div>
		</div>
		
		<div class="form-group" >	
			<label class="col-sm-2 control-label no-padding-right" > 确认密码 </label>
			<div class="col-sm-3">
				<input type="password" name="user.newPasswordr" value="" placeholder="请再次输入新密码" class="form-control"/>
			</div>
		</div>
		
		<div class="space-4"></div>
		<!-- 按钮 -->
		<div class="clearfix form-actions center">
			<div class="col-md-offset-1 col-md-10">
			  	<button class="btn btn-sm btn-info" type="submit" id="btn_save">
					<i class="ace-icon fa fa-check bigger-110"></i>
					保存
				</button>
	
				&nbsp; &nbsp; &nbsp;
				<button class="btn btn-sm" type="button" id="btn_close">
					<i class="ace-icon fa fa-close bigger-110"></i>
					关闭
				</button>
			</div>
		</div>
	</form>
	<script src="${ctxPath}/static/validate/jquery-html5Validate.js"></script>
	<script type="text/javascript">
		var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
	
		$(function(){
			
			$("form").html5Validate(function() {
				$("#btn_save").attr("disabled","disabled");
				var appindex = appLoading();
				var $form = $(this);
				$.post($form.attr("data-url"), $form.serialize(), function(data){
					if (data.code === 0) {
						clearLoading(appindex);
						layer.msg(data.message, {shift: 1});
						setTimeout(function(){
							parent.layer.close(index);
						},500);
						return false;
					} else {
						clearLoading(appindex);
						$("#btn_save").removeAttr("disabled","disabled");
						if(data.code===999){
							layer.alert(data.message, {icon: 2,title:"发生错误"});
						}
						else{
							layer.msg(data.message, {shift: 6,time:2000});
						}
						return false;
					}
				}, "json");
				return false;
			}, {
				// novalidate: false
			});
			
			
			$("#btn_close").bind("click",function(){
				parent.layer.close(index);
			});
			
		});
	
	</script>
@}
